
<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="x-ua-compatible" content="ie=edge">
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" >
	<title>取消</title>
	<link rel="stylesheet" href="../vender/css/normalize.css">
	<link rel="stylesheet" href="cancel-reason.css">
</head>
<body>
<header>
	<img src="return.png" id="return" alt="返回">
	<p>取消理由</p>
</header>
<section>
	<ul>
		<li>
			<span>下错订单</span>
			<form>
				<label>
					<input type="checkbox" class="reason"><i></i>
				</label>
			</form>
		</li>
		<li>
			<span>突然有事</span>
			<form>
				<label>
					<input type="checkbox" class="reason"><i></i>
				</label>
			</form>
		</li>
		<li>
			<span>对方没空</span>
			<form>
				<label>
					<input type="checkbox" class="reason"><i></i>
				</label>
			</form>
		</li>
		<li>
			<span>对方毁约</span>
			<form>
				<label>
					<input type="checkbox" class="reason"><i></i>
				</label>
			</form>
		</li>
		<li>
			<span>难以沟通</span>
			<form>
				<label>
					<input type="checkbox" class="reason"><i></i>
				</label>
			</form>
		</li>
		<li>
			<span>其他</span>
			<form class="text-form">
				<input class="text-input"  id='content' type="text"  />
			</form>
		</li>
	</ul>
</section>
<footer>
	<button class="btn_comfirm">确定</button>
</footer>
<script src="../info/jquery.min.js"></script>
<script src="../vender/src/picturefill.js"></script>
<script src="../layer.js"></script>
<script type="text/javascript">
$("#return").click(function(){
	window.location.href="../studentorder/oder.html";
});
$(".btn_comfirm").click(function(){
	var order_id = localStorage.order_id;
	var token=localStorage.phone;
	var str='';
	$('.reason').each(function(){
		if($(this).prop('checked')){
			str+=$(this).parent().parent().parent().find('span').html()+",";
		}
	})
	str+=$('#content').val();
	if(str==''){
		layer.msg("请输入取消理由");
		return false;
	}
	$.ajax({
		url:"https://newapp.icandrive.cn/api/cancle.php",
		dataType:'json',
		type:'post',
		data:{token:token,order_id:order_id,content:str},
		success:function(data){

			if(data.status==250){
				layer.msg("重新登录");
				setInterval(function(){
					window.location.href="../login/log_in.html";
				},2000);
			}
			if(data.status==200){
//				localStorage.removeItem("user_id");
//				localStorage.removeItem("teacher_id");
				localStorage.removeItem("order_id");
				layer.msg("取消成功");
				setInterval(function(){
					window.location.href="../studentorder/oder.html";
				},2000);

			}
			if(data.status==400){
				layer.msg("操作失败");
				return false;
			}
		},
		error:function(){
			 layer.msg('系统维护中');
		}


	});
	$(this).unbind();
});

</script>
</body>
</html>
